package com.yxy.enumeration;

public enum RateEnum {
    Rate_5(10),
    Rate_4(8),
    Rate_3(6),
    Rate_2(4),
    Rate_1(2);

    private final int value;

    RateEnum(int value){
        this.value = value;
    }

    public int getValue() {
        return value;
    }

    public static int getValueByRate(int val){
        try{
            return RateEnum.valueOf("Rate_"+val).getValue();
        }catch (IllegalArgumentException e){
            return 0;
        }
    }
}
